var img_ = '../deliverGoods/fx.png';


function getData() {
  let goodsInfo = document.getElementById('goodsInfo');
  let porductImagesList = $('#porductImagesList');
  let explain = $('#explain');


  let api = '/App/User/GetGoodsDetails';
  let data = {
    id: '5465a5cd-e8a0-49a8-bf40-99f70e43fd3a',
    idPartnerDTO: '7cabe720-97c6-4f9b-8045-7f06718f613e',
    mobile: '18200525426',
    openId: 'En0014'
  };
  data = getUrlCode();
  ajax('POST', api, data, (res) => {
    let contentString = '';
    let imagesListString = '';
    let explainString='';
    if (res.statusCode === 200) {
      let list = res.data;
      for (let i = 0; i < list.length; i++) {
        let item = list[i];
        let img = '';
        for (let j = 0; j < item.porductImagesList.length; j++) {
          img = item.porductImagesList[j].path;
          if (img) {
            let imgS = `<li><img src="${img}"></li>`;
            imagesListString+=imgS;
          }
        }
        contentString += `
         <div class="d-flex" style="justify-content: space-between">
        <div class="goods-name">${item.goodsName||''}</div>
        <div class="money">￥${item.gold||'0'}</div>
    </div>
    <div class="spec">
        规格：${item.specName||''}
    </div>
    <div class="d-flex">
        <div>颜色：</div>
        <div class="color-name checked-label">${item.colourName||''}</div>
    </div>
    <div class="d-flex">
        <div>方向：</div>
        <div class="direction checked-label">${item.direction||''}</div>
    </div>
    <div class="d-flex" style="justify-content: space-between">
        <div>
            上架时间：${item.createdTime||''}
        </div>
        <div>
            总长：${item.size||''}
        </div>
    </div>
    <div class="d-flex" style="justify-content: center;font-weight: bold">产品介绍</div>
        `;
        explainString=item.explain||'';
      }
    }
    if (imagesListString) {
      imagesListString = `<ul class="am-slides">` + imagesListString + `</ul>`;
    } else {
      imagesListString = `<ul class="am-slides">` +`<li><img src="${img_}"></li>`+ `</ul>`;
    }

    goodsInfo.innerHTML = contentString || '未查询到产品详情';
    porductImagesList.html(imagesListString);
    porductImagesList.flexslider();
    explain.html(explainString);
  }, (e) => {
    goodsInfo.innerHTML = '产品详情异常！';
    porductImagesList.innerHTML = `<ul class="am-slides">` +`<li><img src="${img_}"></li>`+ `</ul>`;
    porductImagesList.flexslider();
  });
}
